function setdirbypick( model )
	local dest = Vector:New( intersect() )
	pos = model.pos
	dir = dest - pos 
	dir:Normalize()

	--ccw is negative
	dir.y = 0
	local angle = setmodelangle( dir )
	

	if dest.y > HeightDisabled then
		scalecoef	= HeightDisabled / dest.y
		dest.y = HeightDisabled
		dest.x = scalecoef * dest.x
		dest.z = scalecoef * dest.z
	end

	model.dir 		= dir 
	model.angle 	= angle
	model.dest 		= dest
	return dest
end

function setmodelangle( dir )
	--ccw is negative
	local angle = math.acos( dir:Dot( RotateBaseDir ) ) 
	sign = ( dir:Cross( RotateBaseDir ) ).y
	if sign > 0 then
		angle = -angle
	end
	return angle
end

